<?php

namespace App\Admin\Renderable;

use App\Models\Article;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class ArticleTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new Article(),function (Grid $grid){
            $grid->column('id')->sortable();
            $grid->showRowSelector();
            $grid->column('title');
            $grid->column('cover')->image('',100,80);
            $grid->column('type')
                 ->using([1 => '动态', 2 => '视频', 3 => '小视频', 4 =>'文章' ,5 => '话题']);
            $grid->paginate(10);
            $grid->disableActions();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->panel();
                $filter->equal('title')->width(3);

            });
        });
    }
}
